]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionSystem: Replace Shell.write_soup_message_to_stream with GBytes usage
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 24 May 2012 16:25:26 +0000 (12:25 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Fri, 25 May 2012 22:25:51 +0000 (18:25 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=676837

js/ui/extensionSystem.js
src/shell-util.c
src/shell-util.h

index 2d64acdab6ab50956520ffc8191a05cb27bbba85..cf7b39a63d9f47e9a7c52051b44dc71482f4cb1e 100644 (file)
@@ -102,7 +102,8 @@ function gotExtensionZipFile(session, message, uuid) {
 
     let [file, stream] = Gio.File.new_tmp('XXXXXX.shell-extension.zip');
     let dir = ExtensionUtils.userExtensionsDir.get_child(uuid);
-    Shell.write_soup_message_to_stream(stream.output_stream, message);
+    let contents = message.response_body.flatten().as_bytes();
+    stream.output_stream.write_bytes(contents, null);
     stream.close(null);
     let [success, pid] = GLib.spawn_async(null,
                                           ['unzip', '-uod', dir.get_path(), '--', file.get_path()],
index 0a1baab39b5d78331ad67a15a26999038d2cda0b..bd211f013c5c84152e0a949b89e0162cf3690924 100644 (file)
@@ -592,29 +592,6 @@ shell_util_get_week_start ()
   return week_start;
 }
 
-/**
- * shell_write_soup_message_to_stream:
- * @stream: a #GOutputStream
- * @message: a #SoupMessage
- * @error: location to store GError
- *
- * Write a string to a GOutputStream as binary data. This is a
- * workaround for the lack of proper binary strings in GJS.
- */
-void
-shell_write_soup_message_to_stream (GOutputStream *stream,
-                                    SoupMessage   *message,
-                                    GError       **error)
-{
-  SoupMessageBody *body;
-
-  body = message->response_body;
-
-  g_output_stream_write_all (stream,
-                             body->data, body->length,
-                             NULL, NULL, error);
-}
-
 /**
  * shell_write_string_to_stream:
  * @stream: a #GOutputStream
index 9208099ad15a5539c16d02a59ef51a1756da215d..fbb8a2773564516dde3c35a4641d201ff4473aa4 100644 (file)
@@ -25,10 +25,6 @@ char    *shell_util_normalize_and_casefold     (const char       *str);
 char    *shell_util_format_date                (const char       *format,
                                                 gint64            time_ms);
 
-void     shell_write_soup_message_to_stream    (GOutputStream    *stream,
-                                                SoupMessage      *message,
-                                                GError          **error);
-
 gboolean shell_write_string_to_stream          (GOutputStream    *stream,
                                                 const char       *str,
                                                 GError          **error);